import http from '@/api/http'

export const damageReportApi = {
  // 获取所有损坏报告
  getAllDamageReports() {
    return http.get('/api/damage-reports')
  },

  // 根据ID获取损坏报告
  getDamageReportById(id) {
    return http.get(`/api/damage-reports/${id}`)
  },

  // 根据报告号获取损坏报告
  getDamageReportByReportNo(reportNo) {
    return http.get(`/api/damage-reports/report-no/${reportNo}`)
  },

  // 根据用户ID获取损坏报告
  getDamageReportsByUserId(userId) {
    return http.get(`/api/damage-reports/user/${userId}`)
  },

  // 根据物品代码获取损坏报告
  getDamageReportsByItemCode(itemCode) {
    return http.get(`/api/damage-reports/item/${itemCode}`)
  },

  // 根据站点代码获取损坏报告
  getDamageReportsBySiteCode(siteCode) {
    return http.get(`/api/damage-reports/site/${siteCode}`)
  },

  // 根据状态获取损坏报告
  getDamageReportsByStatus(status) {
    return http.get(`/api/damage-reports/status/${status}`)
  },

  // 根据损坏类型获取损坏报告
  getDamageReportsByDamageType(damageType) {
    return http.get(`/api/damage-reports/damage-type/${damageType}`)
  },

  // 创建损坏报告
  createDamageReport(damageReport) {
    return http.post('/api/damage-reports', damageReport)
  },

  // 更新损坏报告
  updateDamageReport(id, damageReport) {
    return http.put(`/api/damage-reports/${id}`, damageReport)
  },

  // 删除损坏报告
  deleteDamageReport(id) {
    return http.delete(`/api/damage-reports/${id}`)
  },

  // 根据报告号删除损坏报告
  deleteDamageReportByReportNo(reportNo) {
    return http.delete(`/api/damage-reports/report-no/${reportNo}`)
  }
} 